package com.eascs.p2p.common.entity;

import java.io.Serializable;
import javax.persistence.*;

import com.eascs.p2p.common.wallet.utils.BigDecimalUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
 * The persistent class for the p2p_investor_wallet database table.
 * 
 */
@Entity
@Table(name = "p2p_investor_wallet")
@NamedQuery(name = "P2pInvestorWallet.findAll", query = "SELECT p FROM P2pInvestorWallet p")
public class InvestorWalletEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String id;
	@Column(name = "accumulate_income")
	private BigDecimal accumulateIncome;

	@Column(name = "accumulate_recharge")
	private BigDecimal accumulateRecharge;

	@Column(name = "accumulate_withdraw")
	private BigDecimal accumulateWithdraw;

	@Column(name = "accumulate_vote")
	private BigDecimal accumulateVote;

	@Column(name = "await_income")
	private BigDecimal awaitIncome;

	@Column(name = "await_principal")
	private BigDecimal awaitPrincipal;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time")
	private Date createTime;

	@Column(name = "current_balance")
	private BigDecimal currentBalance;

	private String features;

	@Column(name = "invest_frozen")
	private BigDecimal investFrozen;

	@Column(name = "investor_id")
	private String investorId;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time")
	private Date updateTime;

	private int version;

	@Column(name = "withdraw_frozen")
	private BigDecimal withdrawFrozen;

	public InvestorWalletEntity() {
	}

	public InvestorWalletEntity(Boolean isDefault) {
		if (isDefault) {
			BigDecimal bigDecimal = new BigDecimal(0.00);
			this.accumulateIncome = bigDecimal;
			this.accumulateRecharge = bigDecimal;
			this.accumulateWithdraw = bigDecimal;
			this.accumulateVote = bigDecimal;
			this.awaitIncome = bigDecimal;
			this.awaitPrincipal = bigDecimal;
			this.currentBalance = bigDecimal;
			this.investFrozen = bigDecimal;
			this.withdrawFrozen = bigDecimal;
		}
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public BigDecimal getAccumulateIncome() {
		return BigDecimalUtils.convertNull(this.accumulateIncome);
	}

	public void setAccumulateIncome(BigDecimal accumulateIncome) {
		this.accumulateIncome = accumulateIncome;
	}

	public BigDecimal getAccumulateRecharge() {
		return BigDecimalUtils.convertNull(this.accumulateRecharge);
	}

	public void setAccumulateRecharge(BigDecimal accumulateRecharge) {
		this.accumulateRecharge = accumulateRecharge;
	}

	public BigDecimal getAccumulateWithdraw() {
		return BigDecimalUtils.convertNull(this.accumulateWithdraw);
	}

	public void setAccumulateWithdraw(BigDecimal accumulateWithdraw) {
		this.accumulateWithdraw = accumulateWithdraw;
	}

	public BigDecimal getAwaitIncome() {
		return BigDecimalUtils.convertNull(this.awaitIncome);
	}

	public void setAwaitIncome(BigDecimal awaitIncome) {
		this.awaitIncome = awaitIncome;
	}

	public BigDecimal getAwaitPrincipal() {
		return BigDecimalUtils.convertNull(this.awaitPrincipal);
	}

	public void setAwaitPrincipal(BigDecimal awaitPrincipal) {
		this.awaitPrincipal = awaitPrincipal;
	}

	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public BigDecimal getCurrentBalance() {
		return BigDecimalUtils.convertNull(this.currentBalance);
	}

	public void setCurrentBalance(BigDecimal currentBalance) {
		this.currentBalance = currentBalance;
	}

	public String getFeatures() {
		return this.features;
	}

	public void setFeatures(String features) {
		this.features = features;
	}

	public BigDecimal getInvestFrozen() {
		return BigDecimalUtils.convertNull(this.investFrozen);
	}

	public void setInvestFrozen(BigDecimal investFrozen) {
		this.investFrozen = investFrozen;
	}

	public String getInvestorId() {
		return this.investorId;
	}

	public void setInvestorId(String investorId) {
		this.investorId = investorId;
	}

	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public int getVersion() {
		return this.version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public BigDecimal getWithdrawFrozen() {
		return BigDecimalUtils.convertNull(this.withdrawFrozen);
	}

	public void setWithdrawFrozen(BigDecimal withdrawFrozen) {
		this.withdrawFrozen = withdrawFrozen;
	}

	public BigDecimal getAccumulateVote() {
		return BigDecimalUtils.convertNull(this.accumulateVote);
	}

	public void setAccumulateVote(BigDecimal accumulateVote) {
		this.accumulateVote = accumulateVote;
	}

	@Override
	public String toString() {
		return "InvestorWalletEntity [id=" + id + ", accumulateIncome=" + accumulateIncome + ", accumulateRecharge="
				+ accumulateRecharge + ", accumulateWithdraw=" + accumulateWithdraw + ", accumulateVote="
				+ accumulateVote + ", awaitIncome=" + awaitIncome + ", awaitPrincipal=" + awaitPrincipal
				+ ", createTime=" + createTime + ", currentBalance=" + currentBalance + ", features=" + features
				+ ", investFrozen=" + investFrozen + ", investorId=" + investorId + ", updateTime=" + updateTime
				+ ", version=" + version + ", withdrawFrozen=" + withdrawFrozen + "]";
	}
}